import redis,threading
import time
ip = '192.168.16.1'
connre = redis.Redis(ip)
connre.delete('dxdy')

def get_bulk():
    ret =[]
    x = connre.blpop('dxdy')[1]
    x = str(x)
    x = x.replace("'",'').replace('b','')
    sp = str(x).split('#')
    if len(sp)!=4:
        return ret
    x = [int(i) for i in sp]
    ret.append(x)
    while True:
        a = connre.lpop('dxdy')
        if not a:
            return ret
        a = str(a)
        a = a.replace("'",'').replace('b','')
        sp = str(a).split('#')
        if len(sp)!=4:
            continue
        x =[int(i) for i in sp]
        ret.append(x)